package io.shuttle.mbe.api

import io.shuttle.mbe.api.annotation.ChromeMinVersion
import io.shuttle.mbe.api.annotation.ChromeOSOnly
import io.shuttle.mbe.api.annotation.PromiseStyleMinVersion
import io.shuttle.mbe.core.Promise

////////////////////
// Power
////////////////////
/**
 * Use the `Browser.power` API to override the system's power management features.
 *
 * Permissions: "power"
 */
interface Power {
    // Releases a request previously made via requestKeepAwake().
     fun releaseKeepAwake()

    // Reports a user activity in order to awake the screen from a dimmed or turned off state or from a screensaver.
    // Exits the screensaver if it is currently active.
    @PromiseStyleMinVersion(113)
    @ChromeMinVersion(113)
    @ChromeOSOnly
     fun reportActivity(callback: io.shuttle.mbe.api.types.VoidFunction? = null): Promise<Void>

    // Requests that power management be temporarily disabled.
    // level describes the degree to which power management should be disabled.
    // If a request previously made by the same app is still active, it will be replaced by the new request.
     fun requestKeepAwake(level: Level)
    enum class Level {
        // Prevents the system from sleeping in response to user inactivity.
        system,

        // Prevents the display from being turned off or dimmed,
        // or the system from sleeping in response to user inactivity.
        display
    }
}